package com.achartengine.test.activity;

import android.os.Bundle;

import com.achartengine.test.GraphUtils;

import org.achartengine.GraphicalView;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: dengdayi
 * Date:2016/1/11 16:04
 * Description:双曲线
 */
public class HyperbolaActivity extends BaseActivity {

    private GraphicalView mGraphicalView;

    @Override
    public void onCreateBase(Bundle savedInstanceState) {
        mTvTitle.setText("双曲线");

        graphicalView();

        if (mFrameLayout.getChildCount() > 0) {
            mFrameLayout.removeAllViews();
        }

        if (mGraphicalView != null) {
            mFrameLayout.addView(mGraphicalView);
        }
    }

    /**
     * 初始化数据
     */
    private void graphicalView() {
        String[] titles = new String[]{"ALLSCORE", "MYSCORE"};
        List<double[]> values = new ArrayList<>();

        values.add(new double[]{9, 10, 11, 15, 19, 23, 26, 25, 22, 18, 13, 10});

        values.add(new double[]{5, 5.3, 8, 12, 17, 22, 24.2, 24, 19, 15, 9, 6});


        mGraphicalView = (GraphicalView) GraphUtils.getAChartDoubleLine(this, titles, values);
    }
}
